<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Arduino AudioKit HAL: src/AudioKitCodec.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Arduino AudioKit HAL
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">AudioKitCodec.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &quot;AudioKitConfig.h&quot;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160; </div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">// include drivers</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;audio_driver/es7148/es7148.h&quot;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;audio_driver/es7210/es7210.h&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;audio_driver/es7243/es7243.h&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;audio_driver/es8311/es8311.h&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &quot;audio_driver/es8374/es8374.h&quot;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &quot;audio_driver/es8388/es8388.h&quot;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &quot;audio_driver/tas5805m/tas5805m.h&quot;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;board.h&quot;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160; </div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * @brief AudioKit API using the audio_hal</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; </div>
<div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html">   21</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_audio_kit_codec.html">AudioKitCodec</a> {</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;  </div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    <span class="keyword">public</span>:</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">        /// Provides the configuration for input &amp; output</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#afe47a24fada64fe1208b9e4843031bad">   26</a></span>&#160;<span class="comment"></span>        <a class="code" href="struct_audio_kit_config.html">AudioKitConfig</a> <a class="code" href="class_audio_kit_codec.html#afe47a24fada64fe1208b9e4843031bad">defaultConfig</a>() {</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;            <a class="code" href="struct_audio_kit_config.html">AudioKitConfig</a> result;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;            result.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a> = <a class="code" href="audio__hal_8h.html#a0365da45a34e750f87edf33378fadb15aba33695475b6ea2ded974c0ebfa11ef3">AUDIO_HAL_CODEC_MODE_BOTH</a>;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;            <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;        }</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">        /// Provides the configuration for input or output</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#ab7f41c31c55d4ef44752da3661a1e9f6">   33</a></span>&#160;<span class="comment"></span>        <a class="code" href="struct_audio_kit_config.html">AudioKitConfig</a> <a class="code" href="class_audio_kit_codec.html#ab7f41c31c55d4ef44752da3661a1e9f6">defaultConfig</a>(<span class="keywordtype">bool</span> isOutput) {</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;            <a class="code" href="struct_audio_kit_config.html">AudioKitConfig</a> result;</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;            <span class="keywordflow">if</span> (isOutput){</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;                result.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a> = <a class="code" href="audio__hal_8h.html#a0365da45a34e750f87edf33378fadb15ae3393ec7ddddd45580bf951b220eb149">AUDIO_HAL_CODEC_MODE_DECODE</a>; <span class="comment">// dac</span></div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;            } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;                result.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a> = <a class="code" href="audio__hal_8h.html#a0365da45a34e750f87edf33378fadb15ac6281bfaf4f20254445d21eaea74c585">AUDIO_HAL_CODEC_MODE_ENCODE</a>; <span class="comment">// adc</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;            }</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;            <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;        }</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment">        /// Starts the CODEC</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#a8d0f991f17e25959c7a4912f8404674b">   44</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">bool</span> <a class="code" href="class_audio_kit_codec.html#a8d0f991f17e25959c7a4912f8404674b">begin</a>(<a class="code" href="struct_audio_kit_config.html">AudioKitConfig</a> cfg){</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;            config = cfg;</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;            <span class="keywordtype">bool</span> result = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;            audio_hal_conf.<a class="code" href="audio__hal_8h.html#a6b92ec5e564d2dfc4aca70b550129721">adc_input</a> = config.<a class="code" href="struct_audio_kit_config.html#a8ae224cfd264634f4e09e6208cbcf6c0">adc_input</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;            audio_hal_conf.<a class="code" href="audio__hal_8h.html#aa044749c7861339ded44d3a2c6ab448b">dac_output</a> = config.<a class="code" href="struct_audio_kit_config.html#a61712923e2b592811a9e97dbbc9cd108">dac_output</a>;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;            audio_hal_conf.<a class="code" href="audio__hal_8h.html#a29e893fee93ef5f9e309e0caf1f83636">codec_mode</a> = config.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a>;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;            <span class="comment">//audio_hal_conf.i2s_iface = config.master_slave_mode;</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;            <span class="keywordflow">if</span>(<a class="code" href="audio__hal_8h.html#a44547de5e567edc812cec29207db274d">audio_hal_init</a>(&amp;audio_hal_conf, &amp;<a class="code" href="structaudio__hal.html">audio_hal</a>)!=ESP_OK){</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;            }</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160; </div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;            <span class="comment">// setup audio_hal_codec_i2s_iface_t</span></div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;            iface.<a class="code" href="audio__hal_8h.html#a730344407f659f0d733401a8c98b01de">mode</a> = config.<a class="code" href="struct_audio_kit_config.html#add6c0604564d301e8582d8fc5a18d815">master_slave_mode</a>;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;            iface.<a class="code" href="audio__hal_8h.html#a012429b22eb1233016d1e44b5ca56620">fmt</a> = config.<a class="code" href="struct_audio_kit_config.html#a9c3d9f350c847402b7100662ed0b3fe6">fmt</a>;</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;            iface.<a class="code" href="audio__hal_8h.html#a2150600c54d6c38a3360d96583991084">samples</a> = config.<a class="code" href="struct_audio_kit_config.html#a393a54f66142390fe26293eafa546434">samples</a>;</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;            iface.<a class="code" href="audio__hal_8h.html#ae356b066099322cfa5cad38dfd7052ef">bits</a> = config.<a class="code" href="struct_audio_kit_config.html#a3342ffc18b975c3380ea3ccecd6f9b46">bits</a>;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160; </div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;            <span class="comment">// configure codec</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;            <span class="keywordflow">if</span>(<a class="code" href="audio__hal_8h.html#a19410f9a054e4b771cdde88f53bf7a25">audio_hal_codec_iface_config</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>, config.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a>, &amp;iface)!=ESP_OK){</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;                <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;            }</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;            <span class="comment">// start codec driver</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="audio__hal_8h.html#aa0acbf1a2dcd212a95c8d26f8cf4e845">audio_hal_ctrl_codec</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>,  config.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a>,  <a class="code" href="audio__hal_8h.html#aee552957006fd9e1196ba1e7b55c59aca3cfc31a6b18d46c8803ec190b677449a">AUDIO_HAL_CTRL_START</a>)==ESP_OK;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        }</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="comment">        /// Stops the CODEC</span></div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#aa2df99538eaa80f5d6f3d0a46260a3ff">   71</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">bool</span> <a class="code" href="class_audio_kit_codec.html#aa2df99538eaa80f5d6f3d0a46260a3ff">end</a>(){</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;            <span class="comment">// stop codec driver</span></div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;            <a class="code" href="audio__hal_8h.html#aa0acbf1a2dcd212a95c8d26f8cf4e845">audio_hal_ctrl_codec</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>,  config.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a>,  <a class="code" href="audio__hal_8h.html#aee552957006fd9e1196ba1e7b55c59acaa328761379fc6ab704788c974303869d">AUDIO_HAL_CTRL_STOP</a>);</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;            <span class="comment">// deinit</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;            <a class="code" href="audio__hal_8h.html#a051c27c74d0eadc382647e662a4e5c56">audio_hal_deinit</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>) == ESP_OK;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        }</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;<span class="comment">        /// Sets the codec active / inactive</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#aa837be2d865891821021707d149ea7da">   79</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">bool</span> <a class="code" href="class_audio_kit_codec.html#aa837be2d865891821021707d149ea7da">setActive</a>(<span class="keywordtype">bool</span> active){</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="audio__hal_8h.html#aa0acbf1a2dcd212a95c8d26f8cf4e845">audio_hal_ctrl_codec</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>,  config.<a class="code" href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">codec_mode</a>,  active ? <a class="code" href="audio__hal_8h.html#aee552957006fd9e1196ba1e7b55c59aca3cfc31a6b18d46c8803ec190b677449a">AUDIO_HAL_CTRL_START</a> : <a class="code" href="audio__hal_8h.html#aee552957006fd9e1196ba1e7b55c59acaa328761379fc6ab704788c974303869d">AUDIO_HAL_CTRL_STOP</a> )==ESP_OK;</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        }</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;<span class="comment">        /// Mutes the output</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#a2f620e1680560b710580c19c200b2a8f">   84</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">bool</span> <a class="code" href="class_audio_kit_codec.html#a2f620e1680560b710580c19c200b2a8f">setMute</a>(<span class="keywordtype">bool</span> mute){</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="audio__hal_8h.html#a6c2d469da8d3ca5ff872118b781ec819">audio_hal_set_mute</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>, mute) == ESP_OK;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        }</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="comment">        /// Defines the Volume</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#acc9843ddae6363d2efcfafea1a8008f7">   89</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">bool</span> <a class="code" href="class_audio_kit_codec.html#acc9843ddae6363d2efcfafea1a8008f7">setVolume</a>(<span class="keywordtype">int</span> vol){</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;            <span class="keywordflow">return</span> (vol&gt;0) ? <a class="code" href="audio__hal_8h.html#af0d9e63dc6b047f901fabae1ad593181">audio_hal_set_volume</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>, vol) == ESP_OK : <span class="keyword">false</span>;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;        }</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="comment">        /// Determines the volume</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="class_audio_kit_codec.html#aea72903f9b875cfe9ceda1becde2ca46">   94</a></span>&#160;<span class="comment"></span>        <span class="keywordtype">int</span> <a class="code" href="class_audio_kit_codec.html#aea72903f9b875cfe9ceda1becde2ca46">volume</a>(){</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;            <span class="keywordtype">int</span> <a class="code" href="class_audio_kit_codec.html#aea72903f9b875cfe9ceda1becde2ca46">volume</a>;</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;            <span class="keywordflow">if</span> (<a class="code" href="audio__hal_8h.html#aed3ea4ba76d2470f978de0946d2be51b">audio_hal_get_volume</a>(&amp;<a class="code" href="structaudio__hal.html">audio_hal</a>, &amp;<a class="code" href="class_audio_kit_codec.html#aea72903f9b875cfe9ceda1becde2ca46">volume</a>)!=ESP_OK){</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;                <a class="code" href="class_audio_kit_codec.html#aea72903f9b875cfe9ceda1becde2ca46">volume</a> = -1;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;            }</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="class_audio_kit_codec.html#aea72903f9b875cfe9ceda1becde2ca46">volume</a>;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;        }</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="keyword">protected</span>:</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;        <a class="code" href="structaudio__hal.html">audio_hal_func_t</a> <a class="code" href="structaudio__hal.html">audio_hal</a>;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;        <a class="code" href="audio__hal_8h.html#structaudio__hal__codec__config__t">audio_hal_codec_config_t</a> audio_hal_conf;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        <a class="code" href="audio__hal_8h.html#structaudio__hal__codec__i2s__iface__t">audio_hal_codec_i2s_iface_t</a> iface;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        <a class="code" href="struct_audio_kit_config.html">AudioKitConfig</a> config;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160; </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;};</div>
<div class="ttc" id="aaudio__hal_8h_html_a012429b22eb1233016d1e44b5ca56620"><div class="ttname"><a href="audio__hal_8h.html#a012429b22eb1233016d1e44b5ca56620">audio_hal_codec_i2s_iface_t::fmt</a></div><div class="ttdeci">audio_hal_iface_format_t fmt</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00125">audio_hal.h:125</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_a0365da45a34e750f87edf33378fadb15aba33695475b6ea2ded974c0ebfa11ef3"><div class="ttname"><a href="audio__hal_8h.html#a0365da45a34e750f87edf33378fadb15aba33695475b6ea2ded974c0ebfa11ef3">AUDIO_HAL_CODEC_MODE_BOTH</a></div><div class="ttdeci">@ AUDIO_HAL_CODEC_MODE_BOTH</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00048">audio_hal.h:48</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_a0365da45a34e750f87edf33378fadb15ac6281bfaf4f20254445d21eaea74c585"><div class="ttname"><a href="audio__hal_8h.html#a0365da45a34e750f87edf33378fadb15ac6281bfaf4f20254445d21eaea74c585">AUDIO_HAL_CODEC_MODE_ENCODE</a></div><div class="ttdeci">@ AUDIO_HAL_CODEC_MODE_ENCODE</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00046">audio_hal.h:46</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_a0365da45a34e750f87edf33378fadb15ae3393ec7ddddd45580bf951b220eb149"><div class="ttname"><a href="audio__hal_8h.html#a0365da45a34e750f87edf33378fadb15ae3393ec7ddddd45580bf951b220eb149">AUDIO_HAL_CODEC_MODE_DECODE</a></div><div class="ttdeci">@ AUDIO_HAL_CODEC_MODE_DECODE</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00047">audio_hal.h:47</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_a051c27c74d0eadc382647e662a4e5c56"><div class="ttname"><a href="audio__hal_8h.html#a051c27c74d0eadc382647e662a4e5c56">audio_hal_deinit</a></div><div class="ttdeci">esp_err_t audio_hal_deinit(audio_hal_handle_t audio_hal)</div><div class="ttdoc">Uninitialize media codec driver.</div></div>
<div class="ttc" id="aaudio__hal_8h_html_a19410f9a054e4b771cdde88f53bf7a25"><div class="ttname"><a href="audio__hal_8h.html#a19410f9a054e4b771cdde88f53bf7a25">audio_hal_codec_iface_config</a></div><div class="ttdeci">esp_err_t audio_hal_codec_iface_config(audio_hal_handle_t audio_hal, audio_hal_codec_mode_t mode, audio_hal_codec_i2s_iface_t *iface)</div><div class="ttdoc">Set codec I2S interface samples rate &amp; bit width and format either I2S or PCM/DSP.</div></div>
<div class="ttc" id="aaudio__hal_8h_html_a2150600c54d6c38a3360d96583991084"><div class="ttname"><a href="audio__hal_8h.html#a2150600c54d6c38a3360d96583991084">audio_hal_codec_i2s_iface_t::samples</a></div><div class="ttdeci">audio_hal_iface_samples_t samples</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00126">audio_hal.h:126</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_a29e893fee93ef5f9e309e0caf1f83636"><div class="ttname"><a href="audio__hal_8h.html#a29e893fee93ef5f9e309e0caf1f83636">audio_hal_codec_config_t::codec_mode</a></div><div class="ttdeci">audio_hal_codec_mode_t codec_mode</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00136">audio_hal.h:136</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_a44547de5e567edc812cec29207db274d"><div class="ttname"><a href="audio__hal_8h.html#a44547de5e567edc812cec29207db274d">audio_hal_init</a></div><div class="ttdeci">audio_hal_handle_t audio_hal_init(audio_hal_codec_config_t *audio_hal_conf, audio_hal_func_t *audio_hal_func)</div><div class="ttdoc">Initialize media codec driver.</div></div>
<div class="ttc" id="aaudio__hal_8h_html_a6b92ec5e564d2dfc4aca70b550129721"><div class="ttname"><a href="audio__hal_8h.html#a6b92ec5e564d2dfc4aca70b550129721">audio_hal_codec_config_t::adc_input</a></div><div class="ttdeci">audio_hal_adc_input_t adc_input</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00134">audio_hal.h:134</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_a6c2d469da8d3ca5ff872118b781ec819"><div class="ttname"><a href="audio__hal_8h.html#a6c2d469da8d3ca5ff872118b781ec819">audio_hal_set_mute</a></div><div class="ttdeci">esp_err_t audio_hal_set_mute(audio_hal_handle_t audio_hal, bool mute)</div><div class="ttdoc">Set voice mute. Enables or disables DAC mute of a codec.</div></div>
<div class="ttc" id="aaudio__hal_8h_html_a730344407f659f0d733401a8c98b01de"><div class="ttname"><a href="audio__hal_8h.html#a730344407f659f0d733401a8c98b01de">audio_hal_codec_i2s_iface_t::mode</a></div><div class="ttdeci">audio_hal_iface_mode_t mode</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00124">audio_hal.h:124</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_aa044749c7861339ded44d3a2c6ab448b"><div class="ttname"><a href="audio__hal_8h.html#aa044749c7861339ded44d3a2c6ab448b">audio_hal_codec_config_t::dac_output</a></div><div class="ttdeci">audio_hal_dac_output_t dac_output</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00135">audio_hal.h:135</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_aa0acbf1a2dcd212a95c8d26f8cf4e845"><div class="ttname"><a href="audio__hal_8h.html#aa0acbf1a2dcd212a95c8d26f8cf4e845">audio_hal_ctrl_codec</a></div><div class="ttdeci">esp_err_t audio_hal_ctrl_codec(audio_hal_handle_t audio_hal, audio_hal_codec_mode_t mode, audio_hal_ctrl_t audio_hal_ctrl)</div><div class="ttdoc">Start/stop codec driver.</div></div>
<div class="ttc" id="aaudio__hal_8h_html_ae356b066099322cfa5cad38dfd7052ef"><div class="ttname"><a href="audio__hal_8h.html#ae356b066099322cfa5cad38dfd7052ef">audio_hal_codec_i2s_iface_t::bits</a></div><div class="ttdeci">audio_hal_iface_bits_t bits</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00127">audio_hal.h:127</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_aed3ea4ba76d2470f978de0946d2be51b"><div class="ttname"><a href="audio__hal_8h.html#aed3ea4ba76d2470f978de0946d2be51b">audio_hal_get_volume</a></div><div class="ttdeci">esp_err_t audio_hal_get_volume(audio_hal_handle_t audio_hal, int *volume)</div><div class="ttdoc">get voice volume.</div></div>
<div class="ttc" id="aaudio__hal_8h_html_aee552957006fd9e1196ba1e7b55c59aca3cfc31a6b18d46c8803ec190b677449a"><div class="ttname"><a href="audio__hal_8h.html#aee552957006fd9e1196ba1e7b55c59aca3cfc31a6b18d46c8803ec190b677449a">AUDIO_HAL_CTRL_START</a></div><div class="ttdeci">@ AUDIO_HAL_CTRL_START</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00076">audio_hal.h:76</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_aee552957006fd9e1196ba1e7b55c59acaa328761379fc6ab704788c974303869d"><div class="ttname"><a href="audio__hal_8h.html#aee552957006fd9e1196ba1e7b55c59acaa328761379fc6ab704788c974303869d">AUDIO_HAL_CTRL_STOP</a></div><div class="ttdeci">@ AUDIO_HAL_CTRL_STOP</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00075">audio_hal.h:75</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_af0d9e63dc6b047f901fabae1ad593181"><div class="ttname"><a href="audio__hal_8h.html#af0d9e63dc6b047f901fabae1ad593181">audio_hal_set_volume</a></div><div class="ttdeci">esp_err_t audio_hal_set_volume(audio_hal_handle_t audio_hal, int volume)</div><div class="ttdoc">Set voice volume.</div></div>
<div class="ttc" id="aaudio__hal_8h_html_structaudio__hal__codec__config__t"><div class="ttname"><a href="audio__hal_8h.html#structaudio__hal__codec__config__t">audio_hal_codec_config_t</a></div><div class="ttdoc">Configure media hal for initialization of audio codec chip.</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00133">audio_hal.h:133</a></div></div>
<div class="ttc" id="aaudio__hal_8h_html_structaudio__hal__codec__i2s__iface__t"><div class="ttname"><a href="audio__hal_8h.html#structaudio__hal__codec__i2s__iface__t">audio_hal_codec_i2s_iface_t</a></div><div class="ttdoc">I2s interface configuration for audio codec chip.</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00123">audio_hal.h:123</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html"><div class="ttname"><a href="class_audio_kit_codec.html">AudioKitCodec</a></div><div class="ttdoc">AudioKit API using the audio_hal.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00021">AudioKitCodec.h:21</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_a2f620e1680560b710580c19c200b2a8f"><div class="ttname"><a href="class_audio_kit_codec.html#a2f620e1680560b710580c19c200b2a8f">AudioKitCodec::setMute</a></div><div class="ttdeci">bool setMute(bool mute)</div><div class="ttdoc">Mutes the output.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00084">AudioKitCodec.h:84</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_a8d0f991f17e25959c7a4912f8404674b"><div class="ttname"><a href="class_audio_kit_codec.html#a8d0f991f17e25959c7a4912f8404674b">AudioKitCodec::begin</a></div><div class="ttdeci">bool begin(AudioKitConfig cfg)</div><div class="ttdoc">Starts the CODEC.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00044">AudioKitCodec.h:44</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_aa2df99538eaa80f5d6f3d0a46260a3ff"><div class="ttname"><a href="class_audio_kit_codec.html#aa2df99538eaa80f5d6f3d0a46260a3ff">AudioKitCodec::end</a></div><div class="ttdeci">bool end()</div><div class="ttdoc">Stops the CODEC.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00071">AudioKitCodec.h:71</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_aa837be2d865891821021707d149ea7da"><div class="ttname"><a href="class_audio_kit_codec.html#aa837be2d865891821021707d149ea7da">AudioKitCodec::setActive</a></div><div class="ttdeci">bool setActive(bool active)</div><div class="ttdoc">Sets the codec active / inactive.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00079">AudioKitCodec.h:79</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_ab7f41c31c55d4ef44752da3661a1e9f6"><div class="ttname"><a href="class_audio_kit_codec.html#ab7f41c31c55d4ef44752da3661a1e9f6">AudioKitCodec::defaultConfig</a></div><div class="ttdeci">AudioKitConfig defaultConfig(bool isOutput)</div><div class="ttdoc">Provides the configuration for input or output.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00033">AudioKitCodec.h:33</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_acc9843ddae6363d2efcfafea1a8008f7"><div class="ttname"><a href="class_audio_kit_codec.html#acc9843ddae6363d2efcfafea1a8008f7">AudioKitCodec::setVolume</a></div><div class="ttdeci">bool setVolume(int vol)</div><div class="ttdoc">Defines the Volume.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00089">AudioKitCodec.h:89</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_aea72903f9b875cfe9ceda1becde2ca46"><div class="ttname"><a href="class_audio_kit_codec.html#aea72903f9b875cfe9ceda1becde2ca46">AudioKitCodec::volume</a></div><div class="ttdeci">int volume()</div><div class="ttdoc">Determines the volume.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00094">AudioKitCodec.h:94</a></div></div>
<div class="ttc" id="aclass_audio_kit_codec_html_afe47a24fada64fe1208b9e4843031bad"><div class="ttname"><a href="class_audio_kit_codec.html#afe47a24fada64fe1208b9e4843031bad">AudioKitCodec::defaultConfig</a></div><div class="ttdeci">AudioKitConfig defaultConfig()</div><div class="ttdoc">Provides the configuration for input &amp; output.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_codec_8h_source.html#l00026">AudioKitCodec.h:26</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html"><div class="ttname"><a href="struct_audio_kit_config.html">AudioKitConfig</a></div><div class="ttdoc">Configuation for AudioKit.</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00027">AudioKitConfig.h:27</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html_a3342ffc18b975c3380ea3ccecd6f9b46"><div class="ttname"><a href="struct_audio_kit_config.html#a3342ffc18b975c3380ea3ccecd6f9b46">AudioKitConfig::bits</a></div><div class="ttdeci">audio_hal_iface_bits_t bits</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00035">AudioKitConfig.h:35</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html_a393a54f66142390fe26293eafa546434"><div class="ttname"><a href="struct_audio_kit_config.html#a393a54f66142390fe26293eafa546434">AudioKitConfig::samples</a></div><div class="ttdeci">audio_hal_iface_samples_t samples</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00034">AudioKitConfig.h:34</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html_a61712923e2b592811a9e97dbbc9cd108"><div class="ttname"><a href="struct_audio_kit_config.html#a61712923e2b592811a9e97dbbc9cd108">AudioKitConfig::dac_output</a></div><div class="ttdeci">audio_hal_dac_output_t dac_output</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00030">AudioKitConfig.h:30</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html_a8ae224cfd264634f4e09e6208cbcf6c0"><div class="ttname"><a href="struct_audio_kit_config.html#a8ae224cfd264634f4e09e6208cbcf6c0">AudioKitConfig::adc_input</a></div><div class="ttdeci">audio_hal_adc_input_t adc_input</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00029">AudioKitConfig.h:29</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html_a9c3d9f350c847402b7100662ed0b3fe6"><div class="ttname"><a href="struct_audio_kit_config.html#a9c3d9f350c847402b7100662ed0b3fe6">AudioKitConfig::fmt</a></div><div class="ttdeci">audio_hal_iface_format_t fmt</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00033">AudioKitConfig.h:33</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html_add6c0604564d301e8582d8fc5a18d815"><div class="ttname"><a href="struct_audio_kit_config.html#add6c0604564d301e8582d8fc5a18d815">AudioKitConfig::master_slave_mode</a></div><div class="ttdeci">audio_hal_iface_mode_t master_slave_mode</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00032">AudioKitConfig.h:32</a></div></div>
<div class="ttc" id="astruct_audio_kit_config_html_ae4d2ebbeffb709eda313ff5dffdbb2ab"><div class="ttname"><a href="struct_audio_kit_config.html#ae4d2ebbeffb709eda313ff5dffdbb2ab">AudioKitConfig::codec_mode</a></div><div class="ttdeci">audio_hal_codec_mode_t codec_mode</div><div class="ttdef"><b>Definition:</b> <a href="_audio_kit_config_8h_source.html#l00031">AudioKitConfig.h:31</a></div></div>
<div class="ttc" id="astructaudio__hal_html"><div class="ttname"><a href="structaudio__hal.html">audio_hal</a></div><div class="ttdoc">Configuration of functions and variables used to operate audio codec chip.</div><div class="ttdef"><b>Definition:</b> <a href="audio__hal_8h_source.html#l00143">audio_hal.h:143</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
